﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ASoft.Web.Base;

namespace Asoft.Web.Controllers
{
    public class LoginCheck : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if ((string.Equals(filterContext.ActionDescriptor.ActionName, "upload", StringComparison.CurrentCultureIgnoreCase)
                || string.Equals(filterContext.ActionDescriptor.ActionName, "uploadws", StringComparison.CurrentCultureIgnoreCase))
                && string.Equals(filterContext.ActionDescriptor.ControllerDescriptor.ControllerName, "roomdata", StringComparison.CurrentCultureIgnoreCase))
            {
                base.OnActionExecuting(filterContext);
                return;
            }
            if (!CurrentContext.IsLogin)
            {
                filterContext.Result = new RedirectResult("~/login/index");
            }
            base.OnActionExecuting(filterContext);
        }
    }
}